 <link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.4/bootstrap-editable/css/bootstrap-editable.css">
 <script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.4.4/bootstrap-editable/js/bootstrap-editable.min.js"></script>
 <script src="https://raw.github.com/eternicode/bootstrap-datepicker/master/js/locales/bootstrap-datepicker.it.js"></script>

<ol class="breadcrumb">
  <li><a href="<?php echo $this->webroot;?>">Home</a><span class="divider">/</span></li>
  <li><a href="<?php echo $this->webroot;?>Plan/index">Piano di Lavoro</a><span class="divider">/</span></li>
  <li><a href="<?php echo $this->webroot;?>Plan/view/<?php echo $planDetail["PlanDetail"]["plan_id"];?>">Lista Dettaglio</a><span class="divider">/</span></li>
  <li class="active">Modifica Dettaglio</li>
</ol>
<form method="post" action="<?php echo $this->webroot; ?>Plan/save">
    <input type="hidden" name="PlanDetail[id]" value="<?php echo $planDetail["PlanDetail"]["id"];?>" />
    <input type="hidden" name="PlanDetail[plan_id]" value="<?php echo $planDetail["PlanDetail"]["plan_id"];?>" />
    <input type="hidden" id="data_svolgimento" name="PlanDetail[data_svolgimento]" value="<?php echo $planDetail["PlanDetail"]["data_svolgimento"];?>" />
    <div class="row">
        <div class="span10 offset1">
                <label>Inserisci Titolo :</label>
                <input type="text" id="titolo" value="<?php echo $planDetail["PlanDetail"]["titolo"];?>" name="PlanDetail[titolo]" class="no_border" style="font-size: 20px; width: 100%" placeholder="Titolo" />
                <label>Inserisci l'argomento* :</label>
                <textarea id="argomento" name="PlanDetail[argomento]" rows="15" style="width: 100%" class=""  ><?php echo $planDetail["PlanDetail"]["argomento"];?></textarea>
        </div> 
    </div>  
    <div class="row">
        <div class="span10 offset1">
            <p>Data Previsione svolgimento : <?php echo $planDetail["PlanDetail"]["data_previsione"]!=null?CakeTime::format($planDetail["PlanDetail"]["data_previsione"],  '%d/%m/%Y'):""; ?></p>
            <p>Data Svolgimento effettivo : 
                <?php if($planDetail['Plan']['lock']==0){ ?>
                    <a href="#" id="data_svolgimento_date" data-type="date" data-title="Seleziona la data di svolgimento"> <?php echo $planDetail["PlanDetail"]["data_svolgimento"]!=null?CakeTime::format($planDetail["PlanDetail"]["data_svolgimento"],  '%d/%m/%Y'):""; ?></a>
                <?php }else{?>
                     <?php echo $planDetail["PlanDetail"]["data_svolgimento"]!=null?CakeTime::format($planDetail["PlanDetail"]["data_svolgimento"],  '%d/%m/%Y'):""; ?>
                <?php }?>
                
            </p>
            <label>Inserisci la motivazione per il ritardo :</label>
            <textarea id="argomento" name="PlanDetail[motivazione_posticipo]" rows="10" style="width: 100%" class="    "  ><?php echo $planDetail["PlanDetail"]["motivazione_posticipo"];?></textarea>
  
        </div>
    </div> 
           
    <div class="row">
        <div class="span5">
        </div>
        <div class="span2">
            <button type="submit" class="btn btn-block">Annulla</button>    
        </div>
        <?php if($planDetail['Plan']['lock']==0){ ?>
        <div class="span2">
            <button type="submit" class="btn btn-block btn-danger"><i class="icon-trash"></i>  Elimina</button>    
        </div>
        <div class="span2">
            <button type="submit" class="btn btn-inverse btn-block"><i class="icon-ok"></i>  Salva</button> &nbsp;   
        </div>
        <?php }?>
    </div> 

     
 </div>
 </form>

<script>

    $('#data_svolgimento_date').editable({
        format: 'yyyy-mm-dd',    
        viewformat: 'dd/mm/yyyy',
        emptytext:'Nessuna data selezionata',
        clear:false,  
            validate: function(value) {
                var curr_date = value.getDate();
                var curr_month = (value.getMonth()+1)<10?'0'+(value.getMonth()+1):(value.getMonth()+1);
                var curr_year = value.getFullYear();
                dateformatted = (curr_year + "-" + curr_month + "-" + curr_date);
                $("#data_svolgimento").val(dateformatted);
        },    
        datepicker: {
                weekStart: 1
           }
        }
    );
    
    
 
    
    
    $( document ).ready(function() {
        


    });
       
           
    
</script>